<?php 
	$host = "localhost";
	$userName = "root";
	$pwd = "";
	$dbName = "text";
	$dbms='mysql';
	$dsn="$dbms:host=$host;dbname=$dbName";
	try {
		//尝试连接
		$db = new PDO($dsn,'root','');
		
	} catch (Exception $exc) {
		//捕捉错误
	}
	$db->query('set names utf8');
	
	//执行查询语句
	$result = $db->query("SELECT * FROM `user` where `id` = ".$_POST['id']);
	$result->setFetchMode(PDO::FETCH_ASSOC);
	while($row=$result->fetch()){
		//检测密码
		if($row['pwd']==$_POST['pwd']){
			if($row['isTea']==1){
				$str = 1;
			}else{
				$str = 0;
			}
		}
		else{
			$str = 2;
		}
	}
	exit($str);
?>